<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel='stylesheet' href='../rurple.css' type='text/css'>
<title>After the storm</title>
</head>
<body>

<h2 class="title">23. After the storm</h2>
<p>The wind blew really hard last night.  There is litter everywhere outside Reeborg's house.  His parents asked him to go and clean up the driveway, as well as the path leading to the curb.  They both are in a straight line, with garbage at random places as illustrated below.</p>
<p><img alt="littered driveway" src="../../images/intro/trash1_start.png"></p>
<p>Reeborg should collect all the litter, and put it in the garbage can, situated north of his starting point.  The final situation should look like the following:</p>
<p><img alt="littered driveway" src="../../images/intro/trash1_end.png"></p>
<p>
<span class="warning">Important:</span>To put all the trash in one pile,
you will need to use the test <tt>carries_beepers()</tt> which I hadn't told 
you about ... yet! Try something like<br />
<span class="pykeyword">while</span> <tt>carries_beepers(): ...</tt></p>

<p>Make sure your program work in both situations (world files: trash1.wld and trash2.wld).</p>


<h3 class="try">More yard work!</h3>

<p>
Reeborg's parents are so proud of his work, that they ask him to pick up all the garbage that got blown away in their backyard during the windstorm.  Have Reeborg pick up all the garbage and bring it back with him to his starting position.  Try to generalise from the program you just wrote to clean up the driveway.
</p>
<p>Create your own world file, corresponding to a situation like the one illustrated below.  Your solution should not depend on the exact location of the garbage, nor should it depend on the size of the yard.</p>
<p><img alt="littered yard" src="../../images/intro/trash2.png"></p>

<center>
<a href="22-rain.htm"><img alt="previous"  src="../../images/previous.png"> It's raining</a>
-
<a href="../lessons_toc.htm"><img alt="home"  src="../../images/home.png"></a>
-
<a href="24-adding.htm">Adding <img alt="next"  src="../../images/next.png"></a>
</center>

</body>
</html>